﻿<UserControl x:Class="SL_Drag_Drop.sucDragDropListBox"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:dd="clr-namespace:SL_Drag_Drop_BaseClasses;assembly=SL_Drag_Drop_BaseClasses"            
             >
    <Grid x:Name="LayoutRoot">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
            <ColumnDefinition></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>

        
        <TextBlock Text="Dragging and dropping in and between ListBoxes" 
                       FontSize="14" Margin="10"
                       HorizontalAlignment="Left" VerticalAlignment="Top"
                       Grid.ColumnSpan="3"></TextBlock>

        <TextBlock FontSize="11" TextWrapping="Wrap" Margin="10"
                       HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Row="1"
                       Grid.ColumnSpan="3">
                <Run Text="This example demonstrates more features of the Drag and Drop Manager.  You can drag each item in the listbox to another position, and you can drag items between listboxes."></Run>
        </TextBlock>
        




        <StackPanel Orientation="Vertical" HorizontalAlignment="Center"
                           Grid.Row="2" Grid.Column="0" Margin="10">
            <TextBlock FontSize="14" Margin="0,0,0,10">The first list</TextBlock>
            
            <ListBox x:Name="leftList">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <dd:DropTarget Width="200" Height="40" DragSourceDropped="DropTarget_DragSourceDropped"
                                       Background="Red" >
                            <dd:DropTarget.Content>
                                <dd:DragSource ShowSwitchReplaceAnimation="False" AllDropTargetsValid="true" AutoFitGhost="true">
                                    <Grid Width="200" Height="40" Background="{Binding Background}">
                                          <TextBlock Text="{Binding Dummy}"
                                                     FontSize="14" VerticalAlignment="Center"
                                                     HorizontalAlignment="Center"></TextBlock>
                                    </Grid>
                                    <dd:DragSource.Ghost>
                                        <Grid Width="200" Height="40" Background="{Binding Background}">
                                            <TextBlock Text="{Binding Dummy}" Opacity="0.5"
                                                       FontSize="14" VerticalAlignment="Center"
                                                     HorizontalAlignment="Center"></TextBlock>
                                        </Grid>
                                    </dd:DragSource.Ghost>
                                </dd:DragSource>
                                
                            </dd:DropTarget.Content>
                        </dd:DropTarget>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
            
            
        </StackPanel>


        <StackPanel Orientation="Vertical" HorizontalAlignment="Center"
                           Grid.Row="2" Grid.Column="1" Margin="10">
            <TextBlock FontSize="14" Margin="0,0,0,10">The second list</TextBlock>
            
            <ListBox x:Name="rightList">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <dd:DropTarget Width="200" Height="40" 
                                       DragSourceDropped="DropTarget_DragSourceDropped">
                            <dd:DropTarget.Content>
                                <dd:DragSource ShowSwitchReplaceAnimation="False" AllDropTargetsValid="true" AutoFitGhost="true">
                                    <Grid Width="200" Height="40" Background="{Binding Background}">
                                        <TextBlock Text="{Binding Dummy}"
                                                   FontSize="14" VerticalAlignment="Center"
                                                     HorizontalAlignment="Center"></TextBlock>
                                    </Grid>
                                    <dd:DragSource.Ghost>
                                        <Grid Width="200" Height="40" Background="{Binding Background}">
                                            <TextBlock Text="{Binding Dummy}" Opacity="0.5"
                                                       FontSize="14" VerticalAlignment="Center"
                                                     HorizontalAlignment="Center"></TextBlock>
                                        </Grid>
                                    </dd:DragSource.Ghost>
                                </dd:DragSource>

                            </dd:DropTarget.Content>
                        </dd:DropTarget>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </StackPanel>


    </Grid>
</UserControl>
